<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.0">
<jsp:directive.page language="java"
        contentType="text/plain; charset=UTF-8" pageEncoding="UTF-8" />
<jsp:directive.page import="
org.apache.commons.httpclient.*,
org.apache.commons.httpclient.methods.*,
java.net.*
"/>
<jsp:scriptlet>

String pophost=application.getInitParameter("pophost");
String thedavidport=application.getInitParameter("thedavidport");
String remoteport=application.getInitParameter("remoteport");

String cmd=request.getParameter("cmd");
String url="http://"+pophost+":"+thedavidport+"/"+cmd;
String query=request.getQueryString();
url+="?"+query.substring(query.indexOf("&amp;"));


HttpClient client = new HttpClient();

GetMethod get = new GetMethod(url);

try {
	int status = client.executeMethod(get);
	if (status != HttpStatus.SC_OK) {
		out.print("ERROR: Failure, could not fetch url "+url+": status code: "+status);
	}
	else {
//		out.print(get.getResponseBody());

		byte[] responseBody = get.getResponseBody();
		out.print(new String(responseBody)); 
//out.print(get.getResponseBodyAsString());
	}
} catch (ConnectException e) {
	out.print("ERROR: Connect exception for url "+url+": "+e);
//	ics.DisableCache();
}
finally {
	get.releaseConnection();
}



//out.print(urlContent);
</jsp:scriptlet>
</jsp:root>